<?php include PATH_TPL."/tpl_header.html" ?>
<script type="text/javascript">
	$(function(){
		$("#course-menu").addClass('in');
		$(".deleteBtn").click(function(){
			var course_id = '';
			var studentUrl = "/index.php/student/";
			course_id = $(this).attr('name');
			$('#submit').click(function() {
				location.href = studentUrl+'deleteCourse/id/'+course_id;
			})
		})
	})
</script>

<div class="header">
    <h1 class="page-title">课程管理</h1>
</div>
        
<ul class="breadcrumb">
    <li><a>课程管理</a> <span class="divider">/</span></li>
    <li class="active">已选的课程</li>
</ul>

<div class="container-fluid">
    <div class="row-fluid">
		<div class="well">
		    <table class="table">
		    	<?php if (!empty($allCourse)) {?>
		      <thead>
		        <tr>
		          <th><?php echo $fieldName['course_id']['comment'] ?></th>
		          <th><?php echo $fieldName['coursename']['comment'] ?></th>
		          <th><?php echo $fieldName['course_description']['comment']?></th>
		          <th><?php echo $fieldName['term']['comment'] ?></th>
		          <th><?php echo $fieldName['credit']['comment'] ?></th>
		          <th><?php echo $fieldName['hours']['comment'] ?></th>
		          <th><?php echo $fieldName['plimit']['comment'] ?></th>
		          <th><?php echo $fieldName['persons']['comment'] ?></th>
		          <th style="width: 100px;">操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php foreach ($allCourse as $course) { ?>
		        <tr>
		          <td><?php echo $course['course_id']; ?></td>
		          <td><?php echo $course["coursename"]; ?></td>
		          <td>
		          	<abbr title="<?php echo $course['course_description'] ?>" style="font-style: italic">课程描述</abbr>
		          </td>
		          <td><?php echo $term[$course['term']]?></td>
		          <td><?php echo $course['credit']?></td>
		          <td><?php echo $course['hours']?></td>
		          <td><?php echo $course['plimit']?></td>
		          <td>
		          	<?php if($course['plimit']==$course['persons']) echo "<font color='red'>".$course['persons']."</font>"; else echo $course['persons'];?>
		          </td>
		          <td>
					<a href="#deleteBox" role="button" data-toggle="modal" class="deleteBtn" name="<?php echo $course['course_id'];?>">退课</a>
		          </td>
		        </tr>
		        <?php }?>
		        <tr>
		        	<td colspan="9">
		        		<i>注：将鼠标移动到“<font color="blue">课程描述</font>”即可看到对应课程的描述详情</i>
		        	</td>
		        </tr>
		      </tbody>
		      <?php }else{?>
		      <tr><td colspan="9">您未选任何课程</td></tr>
		      <?php }?>
		    </table>
		</div>
		<!--删除警示框-->
		<div class="modal small hide fade" id="deleteBox" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		    <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		        <h3 id="myModalLabel">警告框</h3>
		    </div>
		    <div class="modal-body">
		        <p class="error-text"><i class="icon-warning-sign modal-icon"></i>您确定退订这个课程?</p>
		    </div>
		    <div class="modal-footer">
		        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
		        <button class="btn btn-danger" id="submit" >退课</button>
		    </div>
		</div>
		<!--警示框END-->
	</div>
</div>
<?php include PATH_TPL."/tpl_sidebar.html" ?>